package com.pug.message.mongoservice.message;

import com.pug.message.mongo.MessageMo;
import com.pug.message.mongorepository.MessageRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 飞哥
 * @Title: 学相伴出品
 * @Description: 飞哥B站地址：https://space.bilibili.com/490711252
 * 记得关注和三连哦！
 * @Description: 我们有一个学习网站：https://www.kuangstudy.com
 * @date 2022/3/26$ 21:21$
 */
@Service
@Slf4j
public class MessageServiceImpl implements IMessageService {

    @Autowired
    private MessageRepository messageRepository;

    @Override
    public MessageMo saveMessage(MessageMo messageMo) {
      try {
          MessageMo messageMoDb = messageRepository.save(messageMo);
          return messageMoDb;
      }catch (Exception ex){
          ex.printStackTrace();
          return null;
      }
    }

}
